package com.feel.easycloud.enums;

public enum ApiResultEnum {

    CODE_0("0","success"),
    CODE_100001("100001","系统错误，请联系管理员"),
    CODE_100002("100002","生成验证码失败"),
    CODE_100003("100003","验证码错误"),
    CODE_100004("100004","用户不存在"),
    ;

    private String code;
    private String msg;

    ApiResultEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    /**
     * 通过错误代码查找其中文含义..
     */
    public static String findMsgByCode(String code) {
        for (ApiResultEnum value : ApiResultEnum.values()) {
            if (value.code == code) {
                return value.msg;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
